﻿using System.Text;

namespace ChangeTextWPF
{
    class Attributes
    {
        /// <summary>
        /// Gets path to file
        /// </summary>
        public string FilePath { get; private set; }

        /// <summary>
        /// Gets replacing text
        /// </summary>
        public string TextToFind { get; private set; }

        /// <summary>
        /// Gets text to replace with
        /// </summary>
        public string TextToReplace { get; private set; }

        /// <summary>
        /// Gets text to replace with
        /// </summary>
        public Encoding Encoding { get; private set; }

        /// <summary>
        /// Initialize a new instance of <see cref="Attributes" /> class
        /// </summary>
        /// <param name="filePath">The file path.</param>
        /// <param name="textToFind">The text to find.</param>
        /// <param name="textToReplace">The text to replace.</param>
        /// <param name="encoding">The encoding.</param>
        /// <exception cref="System.ArgumentNullException">fileOrListPath
        /// or
        /// textToFind</exception>
        public Attributes(string filePath, string textToFind, string textToReplace, Encoding encoding=null)
        {
            if (string.IsNullOrEmpty(textToReplace)) textToReplace = string.Empty;
            if (encoding == null)
            {
                Encoding = Encoding.Default;
            }

            FilePath = filePath;
            TextToFind = textToFind;
            TextToReplace = textToReplace;
            Encoding = encoding;

        }
    }
}
